Fixed (new) memory leak
authorparkrrrr <parkrrrr@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Thu, 11 Aug 2005 19:10:10 +0000 (19:10 +0000)
committerparkrrrr <parkrrrr@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Thu, 11 Aug 2005 19:10:10 +0000 (19:10 +0000)
gpsbabel/an1.c

index 8f55c5745e9ad5078ff37aaf5c334a44db29b04e..0b72ce59c21652190cd2d070f2b099e6bcb75611 100644 (file)
@@ -261,6 +261,7 @@ void Destroy_AN1_Waypoint( void *vwpt ) {
        an1_waypoint_record *wpt = (an1_waypoint_record *)vwpt;
        xfree( wpt->name );
        xfree( wpt->fontname );
+       xfree( vwpt );
 }
 
 void Copy_AN1_Waypoint( void **vdwpt, void *vwpt ) {
@@ -284,7 +285,7 @@ static an1_waypoint_record *Alloc_AN1_Waypoint( ) {
 static an1_vertex_record *Alloc_AN1_Vertex();
 
 void Destroy_AN1_Vertex( void *vvertex ) {
-       /* do nothing */
+       xfree( vvertex );
 }
 
 void Copy_AN1_Vertex( void **vdvert, void *vvert ) {
@@ -309,6 +310,7 @@ static an1_line_record *Alloc_AN1_Line();
 void Destroy_AN1_Line( void *vline ) {
        an1_line_record *line = (an1_line_record *)vline;
        xfree( line->name );
+       xfree( vline );
 }
 
 void Copy_AN1_Line( void **vdline, void *vline ) {
@@ -613,7 +615,6 @@ Write_One_AN1_Waypoint( const waypoint *wpt )
        Write_AN1_Waypoint( outfile, rec );
        if ( local ) {
                Destroy_AN1_Waypoint( rec );
-               xfree( rec );
        }
 }
 
@@ -753,7 +754,6 @@ Write_One_AN1_Line( const route_head *rte )
        Write_AN1_Line( outfile, rec );
        if ( local ) {
                Destroy_AN1_Line( rec );
-               xfree( rec );
        }
 }
 
@@ -781,7 +781,6 @@ Write_One_AN1_Vertex( const waypoint *wpt )
        Write_AN1_Vertex( outfile, rec );
        if ( local ) {
                Destroy_AN1_Vertex( rec );
-               xfree( rec );
        }
 }